package org.jzyan.framework.registry.config;

import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.cloud.nacos.registry.NacosRegistration;
import com.alibaba.cloud.nacos.registry.NacosServiceRegistry;
import org.jzyan.framework.registry.endpoint.NacosServiceDeregisterEndpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 * nacos 配置
 * </p>
 *
 * @author jzyan
 * @since 2023-03-01
 */
@Configuration
@ConditionalOnClass({NacosServiceRegistry.class, NacosDiscoveryProperties.class, NacosRegistration.class})
public class NacosConfig {

    @Bean
    public NacosServiceDeregisterEndpoint nacosServiceDeregisterEndpoint(NacosDiscoveryProperties nacosDiscoveryProperties,
                                                                         NacosRegistration nacosRegistration,
                                                                         NacosServiceRegistry nacosServiceRegistry) {
        return new NacosServiceDeregisterEndpoint(nacosDiscoveryProperties, nacosRegistration, nacosServiceRegistry);
    }

}
